<template>
  <div class="purchaseDetail innerPageTable-out-flex" v-if="Object.keys(detailData).length">
    <div class="content_top">
      <div class="cus_title ts">
        <div style="display: flex; align-items: center">
          <span class="base"></span>
          基本信息
        </div>
        <div>
          <div class="enclosure" v-if="detailData.crsrmInvitationBiddingDocument || detailData.crsrmBiddingDocument"
               @click="clickHandle">附件列表
          </div>
          <div class="enclosure" style="margin: 0 10px 0 10px" v-if="detailData.processId" @click="flowHandle">流程跟踪
          </div>
        </div>
      </div>
      <Row
        :gutter="18"
      >
        <Col
          v-for="(key, index) in Object.keys(detailField.baseInfo)"
          :key="index"
          :lg="12"
          :xxl="8">
          <div class="col_box">
            <span class="name">{{ detailField.baseInfo[key].name }} </span>
            <Input
              v-if="detailField.baseInfo[key].type === 'input'"
              v-model="detailData[key]"
              :disabled="true"
            />
            <Select
              :disabled="true"
              v-if="detailField.baseInfo[key].type === 'select'" :value="detailData[key]">
              <Option
                v-for="item in [ { label: detailData[key + 'Str'], value: detailData[key] } ]"
                :value="detailData[key] ? detailData[key] : ''"
                :key="item.value">{{ detailData[key + "Str"] }}
              </Option>
            </Select>
          </div>
        </Col>
      </Row>
      <div
        class="cus_title">
        <span class="purchase"></span>
        报送信息
      </div>
      <Row
        :gutter="18"
      >
        <Col
          v-for="(key, index) in Object.keys(detailField.submitInfo)"
          :key="index"
          :lg="12"
          :xxl="8">
          <div class="col_box">
            <span class="name">{{ detailField.submitInfo[key].name }} </span>
            <Input
              v-if="detailField.submitInfo[key].type === 'input'"
              v-model="detailData[key]"
              :disabled="true"
            />
            <Select
              :disabled="true"
              v-if="detailField.submitInfo[key].type === 'select'" :value="detailData[key]">
              <Option
                v-for="item in [ { label: detailData[key + 'Str'], value: detailData[key] } ]"
                :value="detailData[key] ? detailData[key] : ''"
                :key="item.value">{{ detailData[key + "Str"] }}
              </Option>
            </Select>
          </div>
        </Col>
      </Row>
      <div
        class="cus_title">
        <span class="validate"></span>
        数据校验情况
      </div>
      <div style="margin-bottom: 17px; margin-top: 12px;">
      <span>校验结果：
        <i :class="{
            pass: detailData.resultState == 2 || detailData.resultState == 4,
            warning: detailData.resultState == 1,
            fail: detailData.resultState == 0}"
           style="font-style: normal"
        > <span class="circle"></span> {{ detailData.resultStateStr }}</i></span>
      </div>
      <Table :columns="columns" :data="resultTable"></Table>
      <div
        class="cus_title">
        <span class="business"></span>
        业务核准信息
      </div>
      <Form
        :model="submitForm"
        ref="flowForm"
        :label-width="220"
        :rules="rules"
      >
        <template>
          <Form-item
            label="业务核准结果"
            prop="approvedResult"
          >
            <RadioGroup
              v-model="submitForm.approvedResult" @on-change="changeHandle"
            >
              <Radio
                v-for="(item, index) in resultArr"
                :key="index"
                :disabled="disabled || isHistory"
                :label="item.value">{{ item.label }}
              </Radio>
            </RadioGroup>
          </Form-item>
          <Form-item
            label="业务单元报送负责人核准说明"
            prop="buApprovedResultDesc"
          >
            <Input
              :disabled="disabled || isHistory"
              v-model="submitForm.buApprovedResultDesc"
              type="textarea"
              :autosize="{ minRows: 5 }"
            />
          </Form-item>
          <Form-item label="附件上传">
            <cus-upload
              :disabled="disabled || isHistory"
              v-model="uploadedFiles"
              name="files"
              :maxSize="50 * 1024"
              :servicePath="servicePath"/>
          </Form-item>
          <Form-item
            label="守正平台审核说明"
            v-if="isShouZheng"
            prop="szApprovedResultDesc"
          >
            <Input
              :disabled="!(detailData.bpmnState == 4 && currentRole.includes('10')) || isHistory"
              v-model="submitForm.szApprovedResultDesc"
              type="textarea"
              :autosize="{ minRows: 5 }"
            />
          </Form-item>
          <Form-item
            label="集团法律合规部审核说明"
            v-if="isLegal"
            prop="hqApprovedResultDesc"
          >
            <Input
              :disabled="disableHq"
              v-model="submitForm.hqApprovedResultDesc"
              type="textarea"
              :autosize="{ minRows: 5 }"
            />
          </Form-item>
        </template>
      </Form>

      <Modal
        v-model="frontModel"
      >
        <p slot="header">{{ titleModal }}</p>
        <Form :label-width="90" :rules="modalRules" :model="modelForm" ref="modelForm">
          <Form-item label="驳回节点" v-if="handType === 'reject'" prop="taskDefKeys">
            <Select v-model="modelForm.taskDefKeys">
              <Option v-for="item in optionList"
                      :key="item.taskDefKey"
                      :value="item.taskDefKey">{{ item.taskNodeName }}
              </Option>
            </Select>
          </Form-item>
          <Form-item label="备注/意见" prop="message">
            <Input type="textarea" v-model="modelForm.message" :rows="4"></Input>
          </Form-item>
        </Form>
        <div slot="footer">
          <Button type="primary" ghost @click="frontModel = false">取消</Button>
          <Button type="primary" @click="okHandle">确定</Button>
        </div>
      </Modal>

      <Modal
        v-model="showReadWare"
        title="确认"
        @on-ok="toRead"
        width="380"
        @on-cancel="showReadWare = false">
        <p>是否确认已阅警告？</p>
      </Modal>
    </div>

    <div class="btn_box">
      <Button type="primary" style="margin: 0 10px" @click="readWareHandle" v-if="detailData.resultState == 1 && currentRole.includes('1')">已阅警告</Button>
      <Button type="primary" style="margin: 0 10px" @click="editHandle" v-if="showSave && !isHistory">保存</Button>
      <Button type="primary" style="margin: 0 10px" @click="submitHandle" v-if="showSubmit && !isHistory">提交</Button>
      <Button type="primary" style="margin: 0 10px" @click="reSubmitHandle" v-if="showReSubmit && !isHistory">重新提交</Button>
      <Button type="primary" style="margin: 0 10px" @click="revokeHandle" v-if="showRevoke && !isHistory">撤回</Button>

      <Button type="primary" style="margin: 0 10px" @click="approvalHandle" v-if="showApprovalAndReject && !isHistory">审核</Button>
      <Button type="primary" style="margin: 0 10px" @click="rejectHandle" v-if="showApprovalAndReject && !isHistory">驳回</Button>

<!--      <Button type="primary" style="margin: 0 10px" @click="approvalHandle" v-if="showApprovalAndReject3 && !isHistory">审核</Button>
      <Button type="primary" style="margin: 0 10px" @click="rejectHandle" v-if="showApprovalAndReject3 && !isHistory">驳回</Button>-->

      <Button type="default" style="margin: 0 10px" @click="backHandle">返回</Button>
    </div>
  </div>
</template>

<script>
import { stateHandleMix } from "@/views/superviseInfo/mix/stateHandleMix";
import { superviseInfoAPI } from "@api/superviseInfo";
import flowImage from "@/components/flowImage";
import { mapTable } from "@/tools/util";
import enclosureList from "@/components/enclosureList";
import { mapState } from "vuex";
import todoListAPI from "@api/todoListApi";
import cusUpload from "@/components/cusUpload";

export default {
  name: "detailData",
  mixins: [stateHandleMix],
  components: {
    cusUpload
  },
  computed: {
    ...mapState("user", {
      currentUserId: (state) => state.currentSysInfo.id,
      currentRole: (state) => state.currentSysInfo.userPurview.userType.split(',')
    }),
    showSubmit() {
      return !this.detailData.bpmnState && this.currentRole.includes("1");
    },
    showReSubmit() {
      // console.log(this.detailData.bpmnState === 1 && this.flowData.taskDefKey === 'start_task_user_activity' && this.handleUsers.includes(this.currentUserId));
      // debugger
      return this.detailData.bpmnState && this.flowData.taskDefKey === "start_task_user_activity" && this.handleUsers.includes(this.currentUserId);
    },
    showSave() {
/*      const roleArr = ['1', '3', '10']
      const currentRoles = this.currentRole.split(',')
      const taskDefKeys = ['start_task_user_activity', 'start_task_shouzheng_activity', 'sassp_per_jtflhgbsh_task']
      const taskDefKeyResult = taskDefKeys.includes(this.flowData.taskDefKey)
      return (!this.detailData.processId || (this.detailData.processId && taskDefKeyResult)) && currentRoles.some(item => roleArr.includes(item))*/
      // 业务单元负责人
      const show1 = (!this.detailData.processId || (this.detailData.processId && this.flowData.taskDefKey === 'start_task_user_activity')) && this.currentRole.includes('1')
      // 集团法务
      const show3 = this.detailData.processId && this.flowData.taskDefKey === 'sassp_per_jtflhgbsh_task' && this.currentRole.includes('3')
      // 守正审核
      const show10 = this.detailData.processId && this.flowData.taskDefKey === 'start_task_shouzheng_activity' && this.currentRole.includes('10')
      return  (show10 || show1 || show3) && !this.isEnd
    },
    showRevoke() {
      return this.detailData.bpmnState === 1 && this.flowData.taskDefKey !== "start_task_user_activity" && this.detailData.createUserId === this.currentUserId && this.canRevoke;
    },
/*    showApprovalAndReject2() {
      return this.detailData.bpmnState === 1 && this.flowData.taskDefKey !== "start_task_user_activity" && this.handleUsers.includes(this.currentUserId) && this.currentRole.includes("2");
    },
    showApprovalAndReject3() {
      return this.detailData.bpmnState === 2 && this.flowData.taskDefKey !== "start_task_user_activity" && this.handleUsers.includes(this.currentUserId) && this.currentRole.includes("3");
    },*/
    showApprovalAndReject() {
      const bpmnStateArr = [1, 2, 4]
      const roleArr = ['2', '3', '10']
      const currentRoles = this.currentRole
      return bpmnStateArr.includes(this.detailData.bpmnState) && this.flowData.taskDefKey !== "start_task_user_activity" && this.handleUsers.includes(this.currentUserId) && currentRoles.some(item => roleArr.includes(item))
      // console.log(bpmnStateArr.includes(this.detailData.bpmnState), this.flowData.taskDefKey !== "start_task_user_activity", this.handleUsers.includes(this.currentUserId), currentRoles.some(item => roleArr.includes(item)))
    },
    isLegal() {
      const role = ['3', '4', '9', '1', '2', '10']
      const isInclude = role.some(item => this.currentRole.includes(item))
      return (isInclude && this.detailData.bpmnState !== 10) || this.detailData.bpmnState == 10;
    },
    isShouZheng() {
      // 守正角色和法务角色需要看到
      const role = ['10', '3', '4', '9', '1', '2']
      const isInclude = role.some(item => this.currentRole.includes(item))
      return (isInclude && this.detailData.bpmnState !== 10) || this.detailData.bpmnState == 10;
    },
    disabled() {
      // return (this.detailData.bpmnState && this.flowData.taskDefKey !== 'start_task_user_activity' && !this.currentRole.indexOf('1') > -1) || this.detailData.bpmnState == 10
      return !this.currentRole.includes("1") || (this.currentRole.includes("1") && this.detailData.bpmnState && this.flowData.taskDefKey !== "start_task_user_activity") || this.detailData.isUpdate == 1;
    },
    disableHq() {
      const { bpmnState } = this.detailData
      console.log('sss', bpmnState, this.currentRole);
      return (bpmnState == 10 || bpmnState == 3 || !(bpmnState == 2 && this.currentRole.includes('3')) || this.isHistory)
    }
  },
  props: {
    detailField: {
      type: Object,
      default: () => ({})
    },
    detailInfo: {
      type: Object,
      default: () => ({})
    },
    title: {
      type: String,
      default: ""
    },
    tableBelong: {
      type: String,
      default: ""
    },
    isHistory: {
      type: Boolean,
      default: false
    },
    listId: {
      type: String,
      default: ""
    }
  },
  data() {
    const resultValidate = (rule, value, callback) => {
      if (value == 1 && this.detailData.resultState == 2) {
        return callback(new Error('业务核准结果和校验结果一致，请检查'))
      }
      if (value == 2 && this.detailData.resultState == 0) {
        return  callback(new Error('业务核准结果和校验结果一致，请检查'))
      }
      callback()
    };
    return {
      detailData: "",
      isEnd: false,
      columns: [
        { key: "index", title: "序号", width: 80 },
        { key: "sourceSystem", title: "来源系统",width: 100 },
        { key: "riskType", title: "风险类型",width: 150 },
        { key: "riskSub", title: "风险小类" },
        { key: "label", title: "问题标签" },
        {
          key: "desc", title: "问题描述",
          minWidth: 300,
          render: (h, { row }) => {
            const arr = row.desc && row.desc.split('##')
            const arr1 = []
            arr && arr.forEach(item => {
              arr1.push(item, h('br'))
            })
            return h("div", arr1);
          }
        },
        { key: "riskLevel", title: "风险等级", width: 150  },
        { key: "result", title: "校验结果", width: 150 }
      ],
      rules: {
        approvedResult: [
          { required: false, message: "请选择业务核准结果", trigger: "change" },
          { validator: resultValidate, trigger: 'change' },
        ],
        buApprovedResultDesc: [
          { required: false, message: "请输入为业务单元报送负责人核准说明", trigger: "blur" }
        ],
        hqApprovedResultDesc: [
          { required: false, message: "请输入集团法律合规部审核说明", trigger: "blur" }
        ],
        szApprovedResultDesc: [
          { required: false, message: '请输入守正平台审核说明', trigger: 'blur' }
        ]
      },
      modalRules: {
        taskDefKeys: [
          { required: true, message: "请选择驳回节点", trigger: "change" }
        ],
        message: [
          { required: true, message: "请输入备注/意见", trigger: "blur" }
        ]
      },
      modelForm: {
        taskDefKeys: "",
        message: ""
      },
      resultTable: [],
      submitForm: {
        approvedResult: this.detailInfo.approvedResult ? this.detailInfo.approvedResult + "" : "",
        buApprovedResultDesc: this.detailInfo.buApprovedResultDesc ? this.detailInfo.buApprovedResultDesc : "",
        hqApprovedResultDesc: this.detailInfo.hqApprovedResultDesc ? this.detailInfo.hqApprovedResultDesc : "",
        szApprovedResultDesc: this.detailInfo.szApprovedResultDesc ? this.detailInfo.szApprovedResultDesc : "",
        id: this.detailInfo.id,
        isUploadFile: this.detailInfo.isUploadFile ? JSON.parse(this.detailInfo.isUploadFile) : ''
      },

      mapTable: mapTable,
      // roleList: '',
      // currentRoleList: '',
      resultArr: [
        { value: "1", label: "通过" },
        { value: "2", label: "不通过" }
        // { value: "3", label: "无需上报" }
      ],
      flowData: {},
      handleUsers: [],
      canRevoke: false,
      frontModel: false,
      taskId: "",
      titleModal: "",
      handType: "",
      optionList: [],
      belong: "",
      submitParams: {},
      uploadedFiles: this.detailInfo.isUploadFile ? JSON.parse(this.detailInfo.isUploadFile) : [],
      servicePath: window.RPConfig['local'] + '/file/upload',
      showReadWare: false
    };
  },
  watch: {
    uploadedFiles: {
      handler(val) {
        this.submitForm.isUploadFile = JSON.stringify(val)
        console.log('val', val);
      },
      deep: true
    }
  },
  created() {
    this.init();
  },
  methods: {
    init() {
      this.detailData = JSON.parse(JSON.stringify(this.detailInfo));

      // 表1 表3 的数据校验情况特殊处理
      // if (['purchase-info', 'offer-supplier'].includes(location.hash.substring(2))) {
      //   const temp1 = this.detailData.dataProblemsInfo ? this.detailData.dataProblemsInfo.split("$$").map(item => ({ data: item, resource: '1' })) : [];
      //   const temp2 = this.detailData.fileProblemsInfo ? this.detailData.fileProblemsInfo.split("$$").map(item => ({ data: item, resource: '2' })) : [];

      //   this.columns.splice(2, 0, { key: "resource", title: "问题来源" })
      //   this.resultTable = temp1.concat(temp2).map((item, index) => {
      //     const itemArr = item.data.split("&&");
      //     return {
      //       index: index + 1,
      //       label: itemArr[0],
      //       desc: itemArr[1],
      //       result: itemArr[2],
      //       resource: item.resource === '1' ? '结构化数据' : '附件'
      //     };
      //   });
      // } else {
      //   const temp = this.detailData.problemsInfo ? this.detailData.problemsInfo.split("$$") : [];
      //   this.resultTable = temp.map((item, index) => {
      //     const itemArr = item.split("&&");
      //     return {
      //       index: index + 1,
      //       label: itemArr[0],
      //       desc: itemArr[1],
      //       result: itemArr[2]
      //     };
      //   });
      // }

      const temp = this.detailData.problemsInfo ? this.detailData.problemsInfo.split("$$") : [];
      this.resultTable = temp.map((item, index) => {
        const itemArr = item.split("&&");
        return {
          index: index + 1,
          sourceSystem:itemArr[0],
          riskType:itemArr[1],
          riskSub:itemArr[2],
          label: itemArr[3],
          desc: itemArr[4],
          riskLevel:itemArr[5],
          result: itemArr[6]
        };
      });

      if (this.detailData.bpmnState && this.detailData.bpmnState != 10 && this.detailData.bpmnState != 3) {
        this.getFlowData();
        this.undoCheck();
        this.getOptionList();
      }

      this.belong = this.tableBelong ? this.tableBelong : location.hash.substring(2);

      this.submitParams = {
        crsrm_bidding_id: this.detailData.crsrmBiddingId,
        crsrm_category_code: this.detailData.crsrmCategoryCode,
        crsrm_supplier_social_credit: this.detailData.crsrmSupplierSocialCredit,
        crsrm_contract_code: this.detailData.crsrmContractCode,
        crsrm_purchaser_social_credit_code: this.detailData.crsrmPurchaserSocialCreditCode,
        crsrm_seller_social_credit_code: this.detailData.crsrmSellerSocialCreditCode,
        id: this.detailData.id
      }
      this.setRuleBaseOnRole()
    },
    setRuleBaseOnRole() {
      if (this.currentRole.includes('1')) {
        this.rules.approvedResult[0].required = true
        this.rules.buApprovedResultDesc[0].required = true
      }
      if (this.currentRole.includes('10')) {
        this.rules.szApprovedResultDesc[0].required = true
      }
      if (this.currentRole.includes('3')) {
        this.rules.hqApprovedResultDesc[0].required = true
      }
    },
    editHandle() {
      this.$refs["flowForm"].validate((valid) => {
        if (valid) {
          this.submitParams.id = this.detailData.id;
          if (this.detailData.isUpdate == 1) {
            return this.$message.error(' 校验结果更新中，页面暂停数据编辑')
          }
          superviseInfoAPI.editDetail(this.submitForm, this.mapTable[this.belong].editUrl).then(res => {
            this.$message.success("操作成功");
          });
        }
      });
    },
    readWareHandle() {
      this.showReadWare = true
    },
    /**
     * 获取当前流程节点
     */
    getFlowData() {
      this.$Spin.show();
      superviseInfoAPI.getFlowData({ id: this.detailData.processId }).then(res => {
        this.$Spin.hide();
        if (!res.data) {
          this.flowData = {};
          this.handleUsers = [];
          this.taskId = "";
        } else {
          this.flowData = res.data;
          this.handleUsers = res.data.userIds.split(",");
          this.taskId = res.data.taskIds.split(",")[0];
        }
      });
    },
    /**
     * 判断是否可以回退
     */
    undoCheck() {
      superviseInfoAPI.canRevoke({ id: this.detailData.processId }).then(res => {
        this.canRevoke = res.data;
      });
    },
    /**
     * 获取回退节点
     */
    getOptionList() {
      todoListAPI.processRejectNode({ id: this.detailData.processId }).then(res => {
        this.optionList = res.data;
      });
    },
    approvalHandle() {
      this.$refs.flowForm.validate((valid) => {
        if (valid) {
          this.frontModel = true;
          this.handType = "approval";
          this.titleModal = "审批";
        }
      });
    },
    toRead() {
      this.$Spin.show();
      superviseInfoAPI.toRead({ ids: [this.listId] }, mapTable[location.hash.substring(2)].path).then(() => {
        this.$message.success('操作成功')
        superviseInfoAPI.detailPage({ id: this.detailData.id }, this.mapTable[this.belong].detailUrl).then(res => {
          this.detailData = res.data;
          this.$Spin.hide();
        });
      })
    },
    okHandle() {
      this.$refs.modelForm.validate(valid => {
        if (valid) {
          this.frontModel = false;
          this.$Spin.show();
          switch (this.handType) {
            case "reSubmit":
              superviseInfoAPI.reSubmit({
                message: this.modelForm.message,
                taskId: this.taskId,
                values: this.submitForm
              }).then(res => {
                this.$message.success("操作成功");
                this.refresh();
                this.$Spin.hide();
              }).catch(err => this.$Spin.hide());
              break;
            case "reject":
              const params = {
                procInstId: this.detailData.processId,
                message: this.modelForm.message,
                taskDefKey: this.modelForm.taskDefKeys,
                id: this.detailData.id,
                type: this.belong
              };
              superviseInfoAPI.reject(params).then(res => {
                this.$message.success("操作成功");
                this.refresh();
                this.$Spin.hide();
              }).catch(err => this.$Spin.hide());
              break;
            case "approval":
              /*调用保存*/
/*              superviseInfoAPI.editDetail(this.submitForm, this.mapTable[this.belong].editUrl).then(res => {
              });*/
              superviseInfoAPI.approvalHandle({
                message: this.modelForm.message,
                taskId: this.taskId,
                values: this.submitForm
              }).then(res => {
                this.$message.success("操作成功");
                this.refresh();
                this.$Spin.hide();
              }).catch(err => this.$Spin.hide());
          }
          return true;
        } else {
          return false;
        }
      });
    },
    submitHandle() {
      this.$refs.flowForm.validate(valid => {
        if (valid) {
          this.$Spin.show();
          superviseInfoAPI.getDispatchConfig().then(res => {
            if (res.data.code == 0) {
              let data = res.data.data
              let dispatchStartTime = data.dispatchStartTime || ''
              let dispatchEndTime = data.dispatchEndTime || ''
              let continueFlag = false
              // 冻结开始时间、结束时间都没有值，无限制，可以提交
              if (!dispatchStartTime && !dispatchEndTime) {
                continueFlag = true
              // 冻结开始时间有值，结束时间没有值，表示冻结时间段结束时间无限期待通知
              } else if (dispatchStartTime && !dispatchEndTime) {
                let nowTime = new Date().getTime()
                let startTime = new Date(dispatchStartTime).getTime()
                // 当前时间小于开始时间，可以提交
                if (nowTime < startTime) {
                  continueFlag = true
                }
              // 冻结开始时间、结束时间都有值
              } else if (dispatchStartTime && dispatchEndTime) {
                let nowTime = new Date().getTime()
                let startTime = new Date(dispatchStartTime).getTime()
                let endTime = new Date(dispatchEndTime).getTime()
                // 当前时间小于开始时间或者当前时间大于结束时间可以提交
                if (nowTime < startTime || nowTime > endTime) {
                  continueFlag = true
                }
              // 冻结开始时间没有值，结束时间有值---违规设置
              } else {
                this.$Message.error({
                  content: "调度配置信息设置出错，当停止调度结束时间有值时停止调度起始时间不能为空",
                  duration: 5
                });
              }
              if (continueFlag) {
                // 提交的时候，自动保存下，防止没有保存。
                superviseInfoAPI.editDetail(this.submitForm, this.mapTable[this.belong].editUrl).then(res => {});
                superviseInfoAPI.submitDetail(this.submitParams, this.mapTable[this.belong].submitUrl).then(res => {
                  this.$message.success("操作成功");
                  this.$Spin.hide();
                  this.refresh();
                })
              } else {
                this.$message.error('润智采数据已锁定，不允许业务审核提交')
              }
            } else {
              this.$message.error('查询调度配置信息出错')
              this.$Spin.hide();
            }
          }).finally(() => {
            this.$Spin.hide();
          })
        }
      });
    },
    reSubmitHandle() {
      this.$refs.flowForm.validate(valid => {
        if (valid) {
          this.titleModal = "重新提交";
          this.frontModel = true;
          this.handType = "reSubmit";
        }
      });
    },
    refresh() {
      this.$Spin.show();
      superviseInfoAPI.detailPage({ id: this.detailData.id }, this.mapTable[this.belong].detailUrl).then(res => {
        this.detailData = res.data;
        this.$Spin.hide();
        if (this.detailData.bpmnState != 10&&this.detailData.bpmnState != 3) {
          this.getFlowData();
          this.getOptionList();
          this.undoCheck();
        } else {
          this.isEnd = true
        }
      });
    },
    flowHandle() {
      new this.$pageModal(flowImage, { props: { id: this.detailData.processId } });
    },
    backHandle() {
      this.$emit("Close");
    },
    async revokeHandle() {
      this.$confirm.warning(this.$t("确定撤回流程吗？")).then(() => {
        superviseInfoAPI.revoke({ id: this.detailData.processId }).then(res => {
          this.$message.success("操作成功");
          this.refresh();
        });
      });
    },
    rejectHandle() {
      this.titleModal = "驳回";
      this.frontModel = true;
      this.handType = "reject";
    },
    clickHandle() {
      const document = this.detailData.crsrmInvitationBiddingDocument || this.detailData.crsrmBiddingDocument;
      if (!document) return;
      const list = document.split(",");
      let mapList = list.map((item, index) => {
        return {
          index: index + 1,
          fileName: item
        };
      });
      new this.$pageModal(enclosureList, { props: { list: mapList } });
    },
    changeHandle(e) {
/*      if (e == 3) {
        this.$Message.warning({
          content: "请进入采购监管平台更改数据状态为\"无需上报\"！",
          duration: 3
        });
      }*/
    }
  }
};
</script>

<style scoped lang="less">
.purchaseDetail {
  height: 100%;

  .content_top {
    padding: 0 20px;
    height: calc(100% - 50px);
    overflow-y: scroll;
  }

  .ts {
    justify-content: space-between;
  }

  .cus_title {
    display: flex;
    align-items: center;
    padding: 0 20px;
    margin-left: -20px;
    margin-right: -20px;
    height: 46px;
    font-size: 14px;
    color: #111A34;
    letter-spacing: 0;
    text-align: left;
    font-weight: 500;
    background: #F8F9FB;
    position: relative;

    > div:last-child {
      display: flex;

      .enclosure {
        right: 15px;
        color: #1557FF;
        cursor: pointer;
      }
    }

    .base {
      background: url("../asset/icons/base.svg") no-repeat center;
      background-size: cover;
    }

    .purchase {
      background: url('../asset/icons/purchase.svg') no-repeat center;
      background-size: cover;
    }

    .validate {
      background: url('../asset/icons/validate.svg') no-repeat center;
      background-size: cover;
    }

    .business {
      background: url('../asset/icons/business.svg') no-repeat center;
      background-size: cover;
    }

    span {
      display: inline-block;
      width: 17px;
      height: 18px;
      margin-right: 10px;
    }
  }

  .btn_box {
    text-align: right;
    margin-right: 60px;
    margin-top: 10px;
    background: #ffffff;
    transform: translate(0);
  }

  .col_box {
    display: flex;
    margin-top: 18px;
    align-items: center;
  }

  .name {
    display: inline-block;
    min-width: 168px;
    text-align: right;
    margin-right: 18px;
  }

  /deep/ .ivu-form-item {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;

    .ivu-form-item-content {
      flex: 1;
      margin-left: 18px !important;
    }
  }
  /deep/.ivu-input[disabled], /deep/.ivu-select-disabled .ivu-select-selection, /deep/.ivu-select-single{
    color: #666F83 !important;
  }
}
</style>
